package com.link2room.rodimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by LN on 2017/7/11.16:02
 */
@Entity
@Table(name = "draw_prize_base")
@DynamicInsert
public class DrawPrizeBaseEntity extends BaseEntity {
    public enum DrawPrizeBaseEntity_{
        activityCode,code
    }
    private String lhotelGroupCode;
    private String lhotelCode;
    private String code;
    private String name;
    private String prizeType;
    private String numStrategy;
    private String rule;
    private String activityCode;
    /**
     * 抽奖概率设置
     */
    private Integer rate;
    /**
     * 奖品设置数量
     */
    private Integer num;
    /**
     * 当前开放奖品数量
     */
    private Integer currentNum;
    /**
     * 奖品抽取数量
     */
    private Integer occupied;

    @Basic
    @Column(name = "code")
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    @Basic
    @Column(name = "activity_code")
    public String getActivityCode() {
        return activityCode;
    }

    public void setActivityCode(String activityCode) {
        this.activityCode = activityCode;
    }

    @Basic
    @Column(name = "prize_type")
    public String getPrizeType() {
        return prizeType;
    }

    public void setPrizeType(String type) {
        this.prizeType = type;
    }

    @Basic
    @Column(name = "num_strategy")
    public String getNumStrategy() {
        return numStrategy;
    }

    public void setNumStrategy(String prizeType) {
        this.numStrategy = prizeType;
    }

    @Basic
    @Column(name = "rule")
    public String getRule() {
        return rule;
    }

    public void setRule(String rule) {
        this.rule = rule;
    }

    @Basic
    @Column(name = "rate")
    public Integer getRate() {
        return rate;
    }

    public void setRate(Integer rate) {
        this.rate = rate;
    }

    @Basic
    @Column(name = "num")
    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    @Basic
    @Column(name = "current_num")
    public Integer getCurrentNum() {
        return currentNum;
    }

    public void setCurrentNum(Integer currentNum) {
        this.currentNum = currentNum;
    }

    @Basic
    @Column(name = "occupied")
    public Integer getOccupied() {
        return occupied;
    }

    public void setOccupied(Integer occupied) {
        this.occupied = occupied;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DrawPrizeBaseEntity that = (DrawPrizeBaseEntity) o;

        if (code != null ? !code.equals(that.code) : that.code != null) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (prizeType != null ? !prizeType.equals(that.prizeType) : that.prizeType != null) return false;
        if (numStrategy != null ? !numStrategy.equals(that.numStrategy) : that.numStrategy != null) return false;
        if (rule != null ? !rule.equals(that.rule) : that.rule != null) return false;
        if (activityCode != null ? !activityCode.equals(that.activityCode) : that.activityCode != null) return false;
        if (rate != null ? !rate.equals(that.rate) : that.rate != null) return false;
        if (num != null ? !num.equals(that.num) : that.num != null) return false;
        if (currentNum != null ? !currentNum.equals(that.currentNum) : that.currentNum != null) return false;
        return occupied != null ? occupied.equals(that.occupied) : that.occupied == null;
    }

    @Override
    public int hashCode() {
        int result = code != null ? code.hashCode() : 0;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (prizeType != null ? prizeType.hashCode() : 0);
        result = 31 * result + (numStrategy != null ? numStrategy.hashCode() : 0);
        result = 31 * result + (rule != null ? rule.hashCode() : 0);
        result = 31 * result + (activityCode != null ? activityCode.hashCode() : 0);
        result = 31 * result + (rate != null ? rate.hashCode() : 0);
        result = 31 * result + (num != null ? num.hashCode() : 0);
        result = 31 * result + (currentNum != null ? currentNum.hashCode() : 0);
        result = 31 * result + (occupied != null ? occupied.hashCode() : 0);
        return result;
    }
}
